﻿using Application;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;

namespace Web.AdminLTE.Components
{
    [ViewComponent(Name = "Navigation")]
    public class NavigationViewComponent:ViewComponent
    {
        private readonly IMenuService _menuService;
        private readonly IUserService _userService;

        public NavigationViewComponent(IMenuService menuService,IUserService userService)
        {
            _menuService = menuService;
            _userService = userService;
        }

        public IViewComponentResult Invoke()
        {
            Guid userID = ViewBag.UserID;

            var menus = _menuService.GetMenusByUser(userID);
            ViewBag.UserInfo = _userService.GetUserInfo(userID); 

            return View(menus);
        }
    }
}
